<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>任务评价 - 威客任务平台</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
    <div th:replace="~{fragments/header :: header}"></div>
    
    <div class="container mt-4">
        <div class="row justify-content-center">
            <div class="col-md-8">
                <div class="card">
                    <div class="card-header">
                        <h3 class="text-center">任务评价</h3>
                    </div>
                    <div class="card-body">
                        <h5>任务信息</h5>
                        <p><strong>任务标题:</strong> <span th:text="${task.title}">任务标题</span></p>
                        
                        <form th:action="${taskReview.reviewId != null} ? @{/task-reviews/update/{reviewId}(reviewId=${taskReview.reviewId})} : @{/task-reviews}" 
                              th:object="${taskReview}" method="post">
                            
                            <input type="hidden" name="taskId" th:value="${task.taskId}">
                            <input type="hidden" name="applicationId" th:value="${applicationId}" th:if="${applicationId != null}">
                            
                            <div class="mb-3">
                                <label for="rating" class="form-label">评分</label>
                                <select class="form-control" id="rating" th:field="*{rating}" required>
                                    <option value="">请选择评分</option>
                                    <option value="1">1星</option>
                                    <option value="2">2星</option>
                                    <option value="3">3星</option>
                                    <option value="4">4星</option>
                                    <option value="5">5星</option>
                                </select>
                            </div>
                            
                            <div class="mb-3">
                                <label for="content" class="form-label">评价内容</label>
                                <textarea class="form-control" id="content" th:field="*{content}" rows="5" required></textarea>
                            </div>
                            
                            <div class="d-grid">
                                <button type="submit" class="btn btn-primary">
                                    <span th:text="${taskReview.reviewId != null} ? '更新评价' : '提交评价'">提交评价</span>
                                </button>
                                <a th:href="${applicationId != null} ? @{/employer/task-applications/{id}(id=${applicationId})} : @{/employer/tasks}" class="btn btn-secondary mt-2">取消</a>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
    
    <div th:replace="~{fragments/footer :: footer}"></div>
    
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>